<template>
  <div class="index">
    <div class="top">
      <img :src="userInfo.avatar" />
      <span class="user">
        <span class="name">{{ userInfo.nickname }}</span>
        <span class="id">ID：{{ userInfo.uid }}</span>
      </span>
    </div>

    <div class="money">
      <div class="m">
        <p class="m1">我的余额</p>
        <p class="m2">{{ userInfo.now_money }}</p>
      </div>
      <div class="m">
        <p class="m1">当前佣金</p>
        <p class="m2">{{ userInfo.commissionCount }}</p>
      </div>
      <div class="m">
        <p class="m1">优惠券</p>
        <p class="m2">{{ userInfo.couponCount }}</p>
      </div>
    </div>

    <div class="order">
      <div class="_top">
        <span>我的订单</span>
        <div>
          <span> 全部订单 </span>
          <van-icon name="arrow" />
        </div>
      </div>
      <div class="more">
        <div class="img">
          <img
            src=""
          />
          <p>待付款</p>
        </div>
        <div class="img">
          <img
            src=""
          />
          <p>待发货</p>
        </div>
        <div class="img">
          <img
            src=""
          />
          <p>待收货</p>
        </div>
        <div class="img">
          <img
            src=""
          />
          <p>待评价</p>
        </div>
        <div class="img">
          <img src="http://47.115.51.185//h5/img/sh.d28fb46a.png" />
          <p>售后/退款</p>
        </div>
      </div>
    </div>

    <div class="serve">
      <div class="_top">
        我的服务
      </div>
      <div class="box">
        <template v-if="detail.length > 0">
          <div class="content" v-for="i in detail" :key="i.id">
            <img :src="i.pic" alt="" />
            <p>{{ i.name }}</p>
          </div>
        </template>
      </div>
    </div>
    <ButtomTab></ButtomTab>
  </div>
</template>

<script>
import ButtomTab from "@/components/ButtomTab";
import { mapState } from "vuex";
export default {
  name: "My",
  data() {
    return {
      detail: []
    };
  },
  created() {
    console.log(this.userInfo);
    this.$axios.get("api/menu/user").then(d => {
      this.detail = d.data.data.routine_my_menus;
    });
  },
  components: { ButtomTab },
  methods: {},
  computed: {
    ...mapState(["userInfo"])
  }
};
</script>
<style scoped lang="less">
.serve {
  height: 5rem;
  background: white;
  margin: 10px;
  border-radius: 5px;
  ._top {
    line-height: 1rem;
    text-align: left;
    font-size: 0.35rem;
    padding: 0 10px;
    color: rgb(40, 40, 40);
    border-bottom: 1px dotted rgb(238, 238, 238);
  }
  .box {
    height: 4rem;
    display: flex;
    flex-wrap: wrap;
    .content {
      width: 25%;
      height: 2rem;
      padding: 5px 0;
      box-sizing: border-box;
      img {
        width: 40%;
      }
      p {
        margin: 5px 0;
        font-size: 0.33rem;
      }
    }
  }
}
.more {
  // height: 2rem;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  .img {
    width: 20%;
    // height: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 10px 0;
    box-sizing: border-box;
    img {
      width: 40%;
      height: auto;
    }
    p {
      margin: 10px 0;
      font-size: 0.3rem;
    }
  }
}
.order {
  background: white;
  // height: 3rem;
  margin: 10px 10px;
  border-radius: 5px;
  ._top {
    line-height: 1rem;
    display: flex;
    justify-content: space-between;
    font-size: 0.35rem;
    padding: 0 10px;
    color: rgb(40, 40, 40);
    border-bottom: 1px dotted rgb(238, 238, 238);
    div {
      color: rgb(119, 119, 119);
      span {
        vertical-align: middle;
      }
      .van-icon {
        vertical-align: middle;
      }
    }
  }
}
.money {
  margin: 0 10px;
  background: white;
  height: 1.5rem;
  border-radius: 5px;
  margin-top: -0.3rem;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  .m {
    width: 33%;
    height: 1.5rem;
    font-size: 0.35rem;
    color: rgb(170, 170, 170);
    border-right: 1px solid rgb(238, 238, 238);
    &:last-of-type {
      border: none;
    }
    .m1 {
      margin: 5px;
    }
    .m2 {
      margin: 5px;
      color: rgb(44, 44, 44);
      font-size: 0.4rem;
    }
  }
}
.top {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 20px;
  background: rgb(233, 51, 35);
  img {
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid white;
    margin-right: 20px;
  }
  .user {
    font-size: 0.4rem;
    color: white;
    .name {
      display: block;
      text-align: left;
      margin: 5px;
      font-weight: bold;
    }
    .id {
      display: block;
      text-align: left;
      margin: 5px;
      color: rgb(245, 173, 167);
      font-size: 0.37rem;
    }
  }
}
</style>
